﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class order : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        loadStep();
    }
    public void loadStep(){
        string step = Request.QueryString["step"];
        if(step=="1"){
            if(checkValidate()){
                payment.Visible=true;
            }else{
                defaultProduct.Visible = true;
            }
            
        }else if(step=="2"){
            if (checkValidate())
            {
                orderconfirm.Visible = true;
            }
            else
            {
                defaultProduct.Visible = true;
            }
           
        }else if(step=="3"){
            if (checkValidate())
            {
                sucesfull.Visible = true;
            }
            else
            {
                defaultProduct.Visible = true;
            }
            
        }else{
            defaultProduct.Visible=true;
        }

    }
    public bool checkValidate(){
        if (Session["username"] == null || Session["username"]==""){
            ScriptManager.RegisterStartupScript(this, typeof(Page), "Test.com", "<script>alert('Account is Sign out!Please Sign In to continue')</script>", false);

            return false;
        }else if(cartBus.carts.listcart.Count<=0){
            ScriptManager.RegisterStartupScript(this, typeof(Page), "Test.com", "<script>alert('Cart is Empty!!!')</script>", false);
            return false;
        }
        return true;
    }
    
}